package com.sgy.springboot_demo.controller;

import com.sgy.springboot_demo.annotation.Routingwith;
import com.sgy.springboot_demo.config.RoutingDataSourceContext;
import com.sgy.springboot_demo.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Autowired
    private ProductService productService;

    @Routingwith("master")
    @RequestMapping("/findAllProductM")
    public String findAllProductM() {
        productService.findAllProductM();
        return "findAllProductM";
    }

    @Routingwith("slave")
    @RequestMapping("/findAllProductS")
    public String findAllProductS() {
        productService.findAllProductS();
        return "findAllProductS";
    }
}
